﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WhatSNew.AppCode;

namespace WhatSNew.Manage
{
    public partial class UserManage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "del")
            {
                UserInfoAccess userAccess = new UserInfoAccess();
                MessageAccess messageAccess = new MessageAccess();
                CommentAccess commentAccess = new CommentAccess();
                NewsInfoAccess newsInfoAccess = new NewsInfoAccess();
                HistoryAccess historyAccess = new HistoryAccess();

                int idx = Convert.ToInt32(e.CommandArgument.ToString());
                int id = Convert.ToInt32(GridView1.DataKeys[idx].Value.ToString());
                userAccess.Delete(id);
                messageAccess.DeleteByReceive(id);
                messageAccess.DeleteBySend(id);
                commentAccess.DeleteByUser(id);
                GridView1.DataBind();
            }
            else if (e.CommandName == "Edit")
            {
                int idx = Convert.ToInt32(e.CommandArgument.ToString());
                GridView1.EditIndex = idx;
            }
            else if (e.CommandName == "Update")
            {
                int idx = Convert.ToInt32(e.CommandArgument.ToString());
            }
        }
    }
}